// 此处代码来自文心一言的回答
export function toggleFullscreen() {
    const elem = document.documentElement; // 你可以选择任何HTML元素使其全屏
    if (isFullscreenActive()) {
        exitFullscreen();
    } else {
        requestFullscreen(elem);
    }
}

export function requestFullscreen(element: HTMLElement) {
    if (element.requestFullscreen) {
        element.requestFullscreen();
    }
}

export function exitFullscreen() {
    if (document.exitFullscreen) {
        document.exitFullscreen();
    }
}

export function isFullscreenActive(): boolean {
    return !!document.fullscreenElement
}

export default {
    toggleFullscreen, requestFullscreen, exitFullscreen, isFullscreenActive
}
